package myServlet;

import Smt.ServerImp.SupplierServerImp;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@SuppressWarnings("serial")
public class SupplierRemove extends HttpServlet {
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		SupplierServerImp ssi = new SupplierServerImp();
		String re = request.getParameter("Remove");
		if (re != null) {
			int i = Integer.parseInt(re);
			if (ssi.remove(i)) {
				response.sendRedirect("SupplierRead");
			} else {
				request.setAttribute("error", "没有权限！非法操作！");
				request.getRequestDispatcher("SupplierRead").forward(request, response);
			}
		} else {
			response.sendRedirect("SupplierRead");
		}
	}
}
